import os

from pdf_handler import PdfHandler


def batch_handle():
    # 带封面的pdf目录
    dir_path = r"D:\ali\PDF"
    # 处理后的pdf存储位置
    out_dir = r'D:\ali\DIST'

    files = os.listdir(dir_path)
    for file in files:
        if file.endswith(".pdf"):
            print("开始处理" + file)
            pdf_handler = PdfHandler(dir_path + '/' + file, out_dir)
            pdf_handler.remove_page(0)


if __name__ == '__main__':
    batch_handle()
    # pdf_handler = PdfHandler('./pdfdir/电路分析基础上第5版.pdf')
    # # 去除首页版权说明
    # pdf_handler.remove_page(0)
    # # 读取目录
    # pdf_handler.read_catalog()
    # pdf_handler = PdfHandler('./dist/地貌学导论.pdf')
    # pdf_handler.read_outline()
